home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1194_converting_hostid_to_enet_address.rtf < prev    next >
Text File  |  1995-06-12  |  695b  |  31 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f3\fswiss Helvetica;\f1\fmodern Courier;\f2\fmodern Ohlfs;}
  2. \paperw12000
  3. \paperh9000
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q:  How do I convert a hostid into an Ethernet address?\
  7. \
  8. A:  Here is the code to decode a hostid:\
  9.  
  10. \f3\fs24 \
  11.  
  12. \f1     main()\
  13.     \{\
  14.         long    hostid;\
  15.         long    en_address;\
  16.     \
  17.         hostid = gethostid();\
  18.         en_address = (hostid & 0xffffff) + 0x00000f000000;\
  19.     \
  20.         printf("hostid = 0x%x; en_address = 0x%x.\\n", hostid, en_address);\
  21.     \}\
  22.     \
  23.  
  24. \f0\fs28 \
  25. QA261\
  26. \
  27. Valid for 1.0, 2.0, 3.0, 3.1 on NeXT processors\
  28. Not Valid for 3.1 on Intel processors\
  29. \
  30.  
  31.